package com.lyc.kotlin.wanandroid.app

import android.app.Activity
import android.app.Application
import android.content.Context
import android.os.Bundle
import androidx.multidex.MultiDexApplication
import kotlin.properties.Delegates

/**
 * 描述
 *liuyucheng
 * Created By 刘育成 on 2019/7/30.
 */
class App : MultiDexApplication() {

    companion object{
        var context:Context by Delegates.notNull()
            private set

        lateinit var myApp: Application
    }
    override fun onCreate() {
        super.onCreate()
        myApp=this
        context=applicationContext
        registerActivityLifecycleCallbacks(mActivityLifecycleCallbacks)
    }

    private val mActivityLifecycleCallbacks= object :Application.ActivityLifecycleCallbacks{
        override fun onActivityPaused(activity: Activity) {
        }

        override fun onActivityResumed(activity: Activity) {
        }

        override fun onActivityStarted(activity: Activity) {
        }

        override fun onActivityDestroyed(activity: Activity) {
        }

        override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
        }

        override fun onActivityStopped(activity: Activity) {
        }

        override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle) {
        }

    }
}